package com.neusoft.shopping.manager.dao;

import com.neusoft.shopping.manager.entity.LogisticsEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class LogisticsDAOImpl {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    RowMapper<LogisticsEntity> rowMapper=new BeanPropertyRowMapper<>( LogisticsEntity.class);

    public List< LogisticsEntity> qureyAll(){
        String sql="select * from goodsinfo logisticsinfo";
        return jdbcTemplate.query(sql,rowMapper);
    }
    public int add_logistics(LogisticsEntity logistics){
        String sql="insert into logisticsinfo values(null,?,?,?,'N')";
        return jdbcTemplate.update(sql,rowMapper,logistics);
    }
}
